package com.iphone.xkyy.mq;

import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Queue;
import org.springframework.amqp.rabbit.connection.CachingConnectionFactory;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Slf4j
@Configuration
public class RabbitMqConfig {
    @Bean
    //同步销售库存队列
    public Queue purchaseQueue() {
        return new Queue("purchase",true);
    }

    @Bean
    //同步销售会员队列
    public Queue purchaseVipQueue() {
        return new Queue("purchaseVip",true);
    }
    @Bean
    //同步库存队列
    public Queue goodsQueue() {
        return new Queue("goods",true);
    }

    @Bean
    //同步会员信息队列
    public Queue vipQueue() {
        return new Queue("vipMember",true);
    }


    @Bean
    public RabbitTemplate rabbitTemplate(@Autowired CachingConnectionFactory factory) {
        RabbitTemplate rabbitTemplate = new RabbitTemplate(factory);
        return rabbitTemplate;
    }
}
